﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using WoChu.RfClient.Duty;
using WoChu.RfClient.Entity;

namespace WoChu.RfClient.Duty
{
    public class OffShelvesUIRule
    {
        private static OffShelvesUIRule _NewInstance = new OffShelvesUIRule();

        public static OffShelvesUIRule NewInstance
        {
            get
            {
                if (_NewInstance == null)
                {
                    _NewInstance = new OffShelvesUIRule();
                }

                return _NewInstance;
            }
        }

      
        public LocationGoodsInfo GetLocationGoodsInfo(string gbCode)
        {
            try
            {
                LocationGoodsInfo _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IOffShelves>.NewInstance.InvokeWebMethod<LocationGoodsInfo>("GetLocationGoodsInfo", new object[] { gbCode });

                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
                return null;
            }
            
        }

        public OutPutParams<bool> SetOffShelves(string userID, List<LocationGoodsInfo> lstLocationGoods)
        {
            try
            {
                OutPutParams<bool> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IOffShelves>.NewInstance.InvokeWebMethod<List<LocationGoodsInfo>, OutPutParams<bool>>("SetOffShelves", new object[] { userID }, lstLocationGoods);
                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex); 
            }
            return null;
        }

        public List<LocationGoodsInfo> CheckGetLocationGoodsInfo(string gbCode)
        {
            try
            {
                List<LocationGoodsInfo> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IOffShelves>.NewInstance.InvokeWebMethod<List<LocationGoodsInfo>>("CheckGetLocationGoodsInfo", new object[] { gbCode });

                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
                return null;
            }

        }

        public int SetInvTipnumber(string gbCode)
        {
            try
            {
                int tipNumber=WoChu.CF.BaseFrame.WebClient.WebGetHelper<IOffShelves>.NewInstance.InvokeWebMethod<int>("SetInvStatusTip", new object[] { gbCode });
                return tipNumber;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
                return 0;
            }
        }

    }
}
